#include "data.hpp"

void test1(){
    cloud::backupData bd;
    bd.setBackupdata("../src/data.hpp");
    std::cout << bd.is_pack << std::endl;
    std::cout << bd.size << std::endl;
    std::cout << bd.atime << std::endl;
    std::cout << bd.mtime << std::endl;
    std::cout << bd.url_real << std::endl;
    std::cout << bd.url_pack << std::endl;
    std::cout << bd.url << std::endl;
}

void test2(){
    cloud::backupData bd;
    bd.setBackupdata("../src/data.hpp");
    cloud::backupData bd2;
    bd2.setBackupdata("../src/data_test.cc");

    cloud::dataManager dm;
    dm.insert(bd);
    dm.insert(bd2);

    cloud::backupData getbd;
    dm.getOneReal(bd.url_real, &getbd);
    std::cout << getbd.is_pack << std::endl;
    std::cout << getbd.size << std::endl;
    std::cout << getbd.atime << std::endl;
    std::cout << getbd.mtime << std::endl;
    std::cout << getbd.url_real << std::endl;
    std::cout << getbd.url_pack << std::endl;
    std::cout << getbd.url << std::endl;

    std::cout << "---------------------" << std::endl;

    bd.is_pack = true;
    dm.updata(bd);
    dm.getOneUrl(bd.url, &getbd);
    std::cout << getbd.is_pack << std::endl;
    std::cout << getbd.size << std::endl;
    std::cout << getbd.atime << std::endl;
    std::cout << getbd.mtime << std::endl;
    std::cout << getbd.url_real << std::endl;
    std::cout << getbd.url_pack << std::endl;
    std::cout << getbd.url << std::endl;

    std::cout << "---------------------" << std::endl;
    
    std::vector<cloud::backupData> array;
    dm.getAll(&array);
    for(auto it : array){
        it.is_pack = false;
        std::cout << it.is_pack << std::endl;
        std::cout << it.size << std::endl;
        std::cout << it.atime << std::endl;
        std::cout << it.mtime << std::endl;
        std::cout << it.url_real << std::endl;
        std::cout << it.url_pack << std::endl;
        std::cout << it.url << std::endl;
        std::cout << std::endl;
    }
}

void test3(){
    cloud::backupData bd;
    bd.setBackupdata("../src/data.hpp");
    cloud::backupData bd2;
    bd2.setBackupdata("../src/data_test.cc");

    cloud::dataManager dm;
    dm.insert(bd);
    dm.insert(bd2);

}

void test4(){
    cloud::dataManager dm;
    std::vector<cloud::backupData> array;
    // ls(Info, "getAll befor");

    dm.getAll(&array);
    for(auto it : array){
        it.is_pack = false;
        std::cout << it.is_pack << std::endl;
        std::cout << it.size << std::endl;
        std::cout << it.atime << std::endl;
        std::cout << it.mtime << std::endl;
        std::cout << it.url_real << std::endl;
        std::cout << it.url_pack << std::endl;
        std::cout << it.url << std::endl;
        std::cout << std::endl;
    }
}

int main(){

    test4();

    return 0;
}